import { Component, OnInit } from '@angular/core';
import { RouteService } from '../route.service';
import { User } from 'src/app/user';

@Component({
  selector: 'app-testb',
  templateUrl: './testb.component.html',
  styleUrls: ['./testb.component.css']
})
export class TestbComponent implements OnInit {

  users: User[];
  constructor(private routeService: RouteService) { }

  ngOnInit() {
    this.refresh();
  }
  refresh(): void {
    this.routeService.getUsers().subscribe(users => {
      this.users = users;
      console.log(`testb get ${users.length} users`);
    });
  }
}
